import request from '@/utils/request'
/**
 * 用于获取预约产品
 * 1.查询所有预约产品信息
 * 2.添加预约产品
 * 3.删除预约产品
 * 4.完成预约
 */
// 查询所有产品
export function getAllProduct(categoryId,categoryName,pageNum,pageSize,up,name){
  return request({
    url: '/massage/product/list',
    method: 'get',
    params: {categoryId,categoryName,pageNum,pageSize,up,name}
  })
}
// 查看产品预约记录
export function getAllProductAppoint(pageNum,pageSize,data) {
  return request({
    url: '/visit/appointment/product/getList',
    method: 'post',
    params:{pageNum,pageSize},
    data
  })
}
// 添加产品
export function addProduct(data) {
  return request({
    url: '/massage/product',
    method: 'post',
    data
  })
}
// 删除产品信息
export function deleteProduct(id) {
  return request({
    url: '/massage/product/' + id,
    method: 'delete'
  })
}
// 完成产品预约
export function completeProductAppointment(id){
  return request({
    url:'/visit/appointment/product/ok/'+id,
    method: 'post',
  })
}
// 取消预约产品
export function cancelProductAppointment(id){
  return request({
    url:'/visit/appointment/product/cancel/'+id,
    method:'post',
    })
}
// 产品上下架
export function upAndDown(id,status){
  return request({
    url:'/massage/updateProductStatus',
    method:'get',
    params:{id,status}
  })
}
//修改产品
export function updateProduct(id,data){
  return request({
    url:'/massage/product/'+id,
    method:'put',
    data
  })
}
// 查询产品分类
export function queryProductCategory(pageNum,pageSize,name){
  return request({
    url:'/massage/productCategoryWithPage?pageNum=' + pageNum+'&pageSize=' +pageSize+'&name='+name,
    method:'get',
  })
}
//添加产品分类
export function addCategory(data){
  return request({
    url:'/massage/productCategory',
    method:'post',
    data
  })
}
//删除产品分类
export function deleteCategory(id) {
  return request({
    url: '/massage/productCategory/' + id,
    method: 'delete'
  })
}
//修改产品分类
export function updateCategory(id,data){
  return request({
    url:'/massage/productCategory/'+id,
    method:'put',
    data
  })
}
//删除产品预约记录
export function deleteProductAppoint(type){
  return request({
    url:'/visit/appointment/delete/visitProduct?type=' + type,
    method:'delete'
  })
}
